package com.elock.entity;

import java.util.UUID;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.PrePersist;
import javax.persistence.PreUpdate;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;

import com.elock.base.core.annotation.IgnoreCompanyInfoId;
import com.elock.base.core.entity.BaseEntity;

/**
 * 企业信息
 * 
 */
@Entity
@Table(name = "company_info")
@SequenceGenerator(name = "sequenceGenerator", sequenceName = "company_info_sequence")
@IgnoreCompanyInfoId
public class CompanyInfo extends BaseEntity {

	private static final long serialVersionUID = 7959128749534202935L;

	/** 企业全称 */
	private String company_name;

	/** 企业简称 */
	private String simple_name;

	/** 企业编码 */
	private String company_code;

	/** 备注 */
	private String note;

	/** 创建人 */
	private String create_by;

	/** 修改人 */
	private String update_by;

	/** 唯一标识 UUID */
	private String uniqueIdentify;

	/** 活动状态：启用，禁用 */
	private Boolean isEnabled;

	/** 企业域名(前台PC根据这个值来判断是那个企业)*/
	private String webSite;

	/** 激活码 */
	private String activateCode;

	/** 企业Logo */
	private String logo;

	/**
	 * 获取企业名称
	 * @return
	 */
	@Column(name = "company_name", unique = true, nullable = false)
	public String getCompany_name() {
		return company_name;
	}

	/**
	 * 设置企业名称
	 * @param company_name
	 */
	public void setCompany_name(String company_name) {
		this.company_name = company_name;
	}

	/**
	 * 获取 简称
	 * @return simple_name
	 */
	@Column(name = "simple_name", unique = true, nullable = false)
	public String getSimple_name() {
		return simple_name;
	}

	/**
	 * 设置 简称
	 * @param simple_name 简称
	 */
	public void setSimple_name(String simple_name) {
		this.simple_name = simple_name;
	}

	/**
	 * 获取备注
	 * @return
	 */
	@Column(name = "note")
	public String getNote() {
		return note;
	}

	/**
	 * 设置备注
	 * @param note
	 */
	public void setNote(String note) {
		this.note = note;
	}

	/**
	 * 获取创建人
	 * @return
	 */
	@Column(name = "create_by")
	public String getCreate_by() {
		return create_by;
	}

	/**
	 * 设置创建人
	 * @param create_by
	 */
	public void setCreate_by(String create_by) {
		this.create_by = create_by;
	}

	/**
	 * 获取修改人
	 * @return
	 */
	@Column(name = "update_by")
	public String getUpdate_by() {
		return update_by;
	}

	/**
	 * 设置修改人
	 * @param update_by
	 */
	public void setUpdate_by(String update_by) {
		this.update_by = update_by;
	}

	/**
	 * 获取企业编码
	 * @return
	 */
	@Column(name = "company_code", unique = true, nullable = false)
	public String getCompany_code() {
		return company_code;
	}

	/**
	 * 设置企业编码
	 * @param company_code
	 */
	public void setCompany_code(String company_code) {
		this.company_code = company_code;
	}

	/**
	 * 获取 活动状态
	 * @return isEnabled
	 */
	public Boolean getIsEnabled() {
		return isEnabled;
	}

	/**
	 * 设置  活动状态
	 * @param isEnabled
	 */
	public void setIsEnabled(Boolean isEnabled) {
		this.isEnabled = isEnabled;
	}

	/**
	 * 获取企业域名(前台PC根据这个值来判断是那个企业)
	 * @return
	 */
	public String getWebSite() {
		return webSite;
	}

	/**
	 * 设置企业域名(前台PC根据这个值来判断是那个企业)
	 * @param webSite
	 */
	public void setWebSite(String webSite) {
		this.webSite = webSite;
	}

	/**
	 * 激活码
	 * @return the activateCode
	 */
	@Column(unique = true, nullable = false)
	public String getActivateCode() {
		return activateCode;
	}

	/**
	 * 激活码
	 * @param activateCode the activateCode to set
	 */
	public void setActivateCode(String activateCode) {
		this.activateCode = activateCode;
	}

	/**
	 * LOGO
	 * @return the logo
	 */
	public String getLogo() {
		return logo;
	}

	/**
	 * 获取 唯一标识 UUID
	 * @return uniqueIdentify
	 */
	@Column(updatable = false)
	public String getUniqueIdentify() {
		return uniqueIdentify;
	}

	/**
	 * 设置 唯一标识 UUID
	 * @param uniqueIdentify 唯一标识 UUID
	 */
	public void setUniqueIdentify(String uniqueIdentify) {
		this.uniqueIdentify = uniqueIdentify;
	}

	/**
	 * LOGO
	 * @param logo the logo to set
	 */
	public void setLogo(String logo) {
		this.logo = logo;
	}

	@PrePersist
	public void prePersist() {
		if (getIsEnabled() == null) {
			setIsEnabled(true);
		}
		if (getUniqueIdentify() == null) {
			setUniqueIdentify(UUID.randomUUID().toString());
		}
	}

	@PreUpdate
	public void preUpdate() {}
}